package com.topn2;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.mapreduce.Partitioner;

public class TPartitioner extends Partitioner<Tkey, IntWritable> {
    @Override
    public int getPartition(Tkey tkey, IntWritable intWritable, int numPartitions) {

        int year = tkey.getYear();
        int month = tkey.getMonth();

        return ("" + year + month).hashCode() % numPartitions;
    }
}
